package flatlandRPGTest;

import org.lwjgl.util.vector.Vector3f;
import flatlandRPG.Camera;
import flatlandRPG.Entity;

// -------------------------------------------------------------------------
/**
 *  Tests the camera class.
 *
 *  @author evant
 *  @version Apr 17, 2011
 */
public class CameraTest
    extends AbstractEntityTest
{
    private Camera testCamera;

    public void setUp() {
        super.setUp();
        testCamera = (Camera)getEntity();
    }

    @Override
    public Entity getEntity()
    {
        return new Camera();
    }

    // ----------------------------------------------------------
    /**
     * Tests that rotation is set properly.
     */
    public void testRotation() {
        testCamera.setRotation(0, 1, 2);
        Vector3f rotation = testCamera.getRotation();
        assertEquals(0, rotation.getX(), 0.0001);
        assertEquals(1, rotation.getY(), 0.0001);
        assertEquals(2, rotation.getZ(), 0.0001);
    }

    // ----------------------------------------------------------
    /**
     * Tests that rotationX is set properly.
     */
    public void testRotationX() {
        testCamera.setRotationX(1);
        assertEquals(1, testCamera.getRotationX(), 0.0001);
    }
    // ----------------------------------------------------------
    /**
     * Tests that rotationY is set properly.
     */
    public void testRotationY() {
        testCamera.setRotationY(1);
        assertEquals(1, testCamera.getRotationY(), 0.0001);
    }
    // ----------------------------------------------------------
    /**
     * Tests that rotationZ is set properly.
     */
    public void testRotationZ() {
        testCamera.setRotationZ(1);
        assertEquals(1, testCamera.getRotationZ(), 0.0001);
    }
}
